fix: prevent a 404 error when serving Sphinx docs and Bazel is configured with a --symlink_prefix option#3492
Conversation
…ured with a --symlink_prefix option When Bazel is configured with a symlink_prefix option, the execpath Make variable does not resolve to the correct directory for generated HTML files. This change updates the logic to use rpathlocation instead, ensuring the correct path is used regardless of the symlink configuration.
Summary of ChangesHello @laurenshobert, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where serving Sphinx documentation via Bazel's Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue with the sphinxdocs .serve target when Bazel's --symlink_prefix is used. The changes are robust, replacing a fragile path construction with the idiomatic use of rlocationpath and the python.runfiles library. The implementation is solid. I've added one suggestion to improve error handling in sphinx_server.py to make it even more robust.
…urn value of Rlocation.
|
Thanks! |
|
Not related to this PR, just some notes that others might find interesting... Looking at this PR, I ended up going down a rabbit hole of why Bazel has so amny different Digging turned out:
Hindsight is 20/20 😅 |
Related to my comment here: bazel-contrib/rules_python#3492 (comment) Modified from https://github.com/bazelbuild/examples/tree/main/make-variables
|
Thanks! |
…l-contrib#2699) Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.3 to 2.3.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/urllib3/urllib3/releases">urllib3's releases</a>.</em></p> <blockquote> <h2>2.3.0</h2> <h2>🚀 urllib3 is fundraising for HTTP/2 support</h2> <p><a href="https://sethmlarson.dev/urllib3-is-fundraising-for-http2-support">urllib3 is raising ~$40,000 USD</a> to release HTTP/2 support and ensure long-term sustainable maintenance of the project after a sharp decline in financial support for 2023. If your company or organization uses Python and would benefit from HTTP/2 support in Requests, pip, cloud SDKs, and thousands of other projects <a href="https://opencollective.com/urllib3">please consider contributing financially</a> to ensure HTTP/2 support is developed sustainably and maintained for the long-haul.</p> <p>Thank you for your support.</p> <h2>Features</h2> <ul> <li>Added <code>HTTPResponse.shutdown()</code> to stop any ongoing or future reads for a specific response. It calls <code>shutdown(SHUT_RD)</code> on the underlying socket. This feature was <a href="https://opencollective.com/urllib3/contributions/815307">sponsored by LaunchDarkly</a>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/2868">urllib3/urllib3#2868</a>)</li> <li>Added support for JavaScript Promise Integration on Emscripten. This enables more efficient WebAssembly requests and streaming, and makes it possible to use in Node.js if you launch it as node <code>--experimental-wasm-stack-switching</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3400">urllib3/urllib3#3400</a>)</li> <li>Added the <code>proxy_is_tunneling</code> property to <code>HTTPConnection</code> and <code>HTTPSConnection</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3285">urllib3/urllib3#3285</a>)</li> <li>Added pickling support to <code>NewConnectionError</code> and <code>NameResolutionError</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3480">urllib3/urllib3#3480</a>)</li> </ul> <h2>Bugfixes</h2> <ul> <li>Fixed an issue in debug logs where the HTTP version was rendering as "HTTP/11" instead of "HTTP/1.1". (<a href="https://redirect.github.com/urllib3/urllib3/issues/3489">urllib3/urllib3#3489</a>)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Removed support for Python 3.8. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3492">urllib3/urllib3#3492</a>)</li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0">https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/urllib3/urllib3/blob/main/CHANGES.rst">urllib3's changelog</a>.</em></p> <blockquote> <h1>2.3.0 (2024-12-22)</h1> <h2>Features</h2> <ul> <li>Added <code>HTTPResponse.shutdown()</code> to stop any ongoing or future reads for a specific response. It calls <code>shutdown(SHUT_RD)</code> on the underlying socket. This feature was <code>sponsored by LaunchDarkly <https://opencollective.com/urllib3/contributions/815307></code><strong>. (<code>[bazel-contrib#2868](urllib3/urllib3#2868) <https://github.com/urllib3/urllib3/issues/2868></code></strong>)</li> <li>Added support for JavaScript Promise Integration on Emscripten. This enables more efficient WebAssembly requests and streaming, and makes it possible to use in Node.js if you launch it as <code>node --experimental-wasm-stack-switching</code>. (<code>[bazel-contrib#3400](urllib3/urllib3#3400) <https://github.com/urllib3/urllib3/issues/3400></code>__)</li> <li>Added the <code>proxy_is_tunneling</code> property to <code>HTTPConnection</code> and <code>HTTPSConnection</code>. (<code>[bazel-contrib#3285](urllib3/urllib3#3285) <https://github.com/urllib3/urllib3/issues/3285></code>__)</li> <li>Added pickling support to <code>NewConnectionError</code> and <code>NameResolutionError</code>. (<code>[bazel-contrib#3480](urllib3/urllib3#3480) <https://github.com/urllib3/urllib3/issues/3480></code>__)</li> </ul> <h2>Bugfixes</h2> <ul> <li>Fixed an issue in debug logs where the HTTP version was rendering as "HTTP/11" instead of "HTTP/1.1". (<code>[bazel-contrib#3489](urllib3/urllib3#3489) <https://github.com/urllib3/urllib3/issues/3489></code>__)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Removed support for Python 3.8. (<code>[bazel-contrib#3492](urllib3/urllib3#3492) <https://github.com/urllib3/urllib3/issues/3492></code>__)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/urllib3/urllib3/commit/2f68c5363ef632d73dd4d9300289d7ce5ff275b4"><code>2f68c53</code></a> Release 2.3.0</li> <li><a href="https://github.com/urllib3/urllib3/commit/f7bcf6986fa9c43fc7884b648f66688db593b491"><code>f7bcf69</code></a> Add HTTPResponse.shutdown() to stop blocking reads (<a href="https://redirect.github.com/urllib3/urllib3/issues/3527">#3527</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/e94224931feddf9e12bb25452bf0d0c21da8a7e0"><code>e942249</code></a> Update .readthedocs.yml addressing a deprecation (<a href="https://redirect.github.com/urllib3/urllib3/issues/3534">#3534</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/905549d64a948abd4b6962edecb8dd5569166275"><code>905549d</code></a> Upgrade Python pre-commit tools (<a href="https://redirect.github.com/urllib3/urllib3/issues/3529">#3529</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/716d8340b89f7d8ec549579d14e3c0a7e5f859a5"><code>716d834</code></a> Fix PyPI publish with Core metadata 2.4 (<a href="https://redirect.github.com/urllib3/urllib3/issues/3531">#3531</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/7ab935c6ddd546c7d57b03c0269685c61c8e60c6"><code>7ab935c</code></a> Address zizmor issues</li> <li><a href="https://github.com/urllib3/urllib3/commit/181357ed2aecf9c523f2664c05f176cde9692994"><code>181357e</code></a> Bump Quart to fix CI (<a href="https://redirect.github.com/urllib3/urllib3/issues/3524">#3524</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/0e7e0df0586573d51c78076d4871050783bec7c8"><code>0e7e0df</code></a> Start testing with Python 3.14</li> <li><a href="https://github.com/urllib3/urllib3/commit/d67d09bfd04ecdae1280a563d06b32949befaf71"><code>d67d09b</code></a> Bump mypy version</li> <li><a href="https://github.com/urllib3/urllib3/commit/20032ec38a09680bcfb6d97b4c43b276af43cc64"><code>20032ec</code></a> Drop unneeded dependency pins and a warning filter</li> <li>Additional commits viewable in <a href="https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#2698) Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.3 to 2.3.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/urllib3/urllib3/releases">urllib3's releases</a>.</em></p> <blockquote> <h2>2.3.0</h2> <h2>🚀 urllib3 is fundraising for HTTP/2 support</h2> <p><a href="https://sethmlarson.dev/urllib3-is-fundraising-for-http2-support">urllib3 is raising ~$40,000 USD</a> to release HTTP/2 support and ensure long-term sustainable maintenance of the project after a sharp decline in financial support for 2023. If your company or organization uses Python and would benefit from HTTP/2 support in Requests, pip, cloud SDKs, and thousands of other projects <a href="https://opencollective.com/urllib3">please consider contributing financially</a> to ensure HTTP/2 support is developed sustainably and maintained for the long-haul.</p> <p>Thank you for your support.</p> <h2>Features</h2> <ul> <li>Added <code>HTTPResponse.shutdown()</code> to stop any ongoing or future reads for a specific response. It calls <code>shutdown(SHUT_RD)</code> on the underlying socket. This feature was <a href="https://opencollective.com/urllib3/contributions/815307">sponsored by LaunchDarkly</a>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/2868">urllib3/urllib3#2868</a>)</li> <li>Added support for JavaScript Promise Integration on Emscripten. This enables more efficient WebAssembly requests and streaming, and makes it possible to use in Node.js if you launch it as node <code>--experimental-wasm-stack-switching</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3400">urllib3/urllib3#3400</a>)</li> <li>Added the <code>proxy_is_tunneling</code> property to <code>HTTPConnection</code> and <code>HTTPSConnection</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3285">urllib3/urllib3#3285</a>)</li> <li>Added pickling support to <code>NewConnectionError</code> and <code>NameResolutionError</code>. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3480">urllib3/urllib3#3480</a>)</li> </ul> <h2>Bugfixes</h2> <ul> <li>Fixed an issue in debug logs where the HTTP version was rendering as "HTTP/11" instead of "HTTP/1.1". (<a href="https://redirect.github.com/urllib3/urllib3/issues/3489">urllib3/urllib3#3489</a>)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Removed support for Python 3.8. (<a href="https://redirect.github.com/urllib3/urllib3/issues/3492">urllib3/urllib3#3492</a>)</li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0">https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/urllib3/urllib3/blob/main/CHANGES.rst">urllib3's changelog</a>.</em></p> <blockquote> <h1>2.3.0 (2024-12-22)</h1> <h2>Features</h2> <ul> <li>Added <code>HTTPResponse.shutdown()</code> to stop any ongoing or future reads for a specific response. It calls <code>shutdown(SHUT_RD)</code> on the underlying socket. This feature was <code>sponsored by LaunchDarkly <https://opencollective.com/urllib3/contributions/815307></code><strong>. (<code>[bazel-contrib#2868](urllib3/urllib3#2868) <https://github.com/urllib3/urllib3/issues/2868></code></strong>)</li> <li>Added support for JavaScript Promise Integration on Emscripten. This enables more efficient WebAssembly requests and streaming, and makes it possible to use in Node.js if you launch it as <code>node --experimental-wasm-stack-switching</code>. (<code>[bazel-contrib#3400](urllib3/urllib3#3400) <https://github.com/urllib3/urllib3/issues/3400></code>__)</li> <li>Added the <code>proxy_is_tunneling</code> property to <code>HTTPConnection</code> and <code>HTTPSConnection</code>. (<code>[bazel-contrib#3285](urllib3/urllib3#3285) <https://github.com/urllib3/urllib3/issues/3285></code>__)</li> <li>Added pickling support to <code>NewConnectionError</code> and <code>NameResolutionError</code>. (<code>[bazel-contrib#3480](urllib3/urllib3#3480) <https://github.com/urllib3/urllib3/issues/3480></code>__)</li> </ul> <h2>Bugfixes</h2> <ul> <li>Fixed an issue in debug logs where the HTTP version was rendering as "HTTP/11" instead of "HTTP/1.1". (<code>[bazel-contrib#3489](urllib3/urllib3#3489) <https://github.com/urllib3/urllib3/issues/3489></code>__)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Removed support for Python 3.8. (<code>[bazel-contrib#3492](urllib3/urllib3#3492) <https://github.com/urllib3/urllib3/issues/3492></code>__)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/urllib3/urllib3/commit/2f68c5363ef632d73dd4d9300289d7ce5ff275b4"><code>2f68c53</code></a> Release 2.3.0</li> <li><a href="https://github.com/urllib3/urllib3/commit/f7bcf6986fa9c43fc7884b648f66688db593b491"><code>f7bcf69</code></a> Add HTTPResponse.shutdown() to stop blocking reads (<a href="https://redirect.github.com/urllib3/urllib3/issues/3527">#3527</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/e94224931feddf9e12bb25452bf0d0c21da8a7e0"><code>e942249</code></a> Update .readthedocs.yml addressing a deprecation (<a href="https://redirect.github.com/urllib3/urllib3/issues/3534">#3534</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/905549d64a948abd4b6962edecb8dd5569166275"><code>905549d</code></a> Upgrade Python pre-commit tools (<a href="https://redirect.github.com/urllib3/urllib3/issues/3529">#3529</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/716d8340b89f7d8ec549579d14e3c0a7e5f859a5"><code>716d834</code></a> Fix PyPI publish with Core metadata 2.4 (<a href="https://redirect.github.com/urllib3/urllib3/issues/3531">#3531</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/7ab935c6ddd546c7d57b03c0269685c61c8e60c6"><code>7ab935c</code></a> Address zizmor issues</li> <li><a href="https://github.com/urllib3/urllib3/commit/181357ed2aecf9c523f2664c05f176cde9692994"><code>181357e</code></a> Bump Quart to fix CI (<a href="https://redirect.github.com/urllib3/urllib3/issues/3524">#3524</a>)</li> <li><a href="https://github.com/urllib3/urllib3/commit/0e7e0df0586573d51c78076d4871050783bec7c8"><code>0e7e0df</code></a> Start testing with Python 3.14</li> <li><a href="https://github.com/urllib3/urllib3/commit/d67d09bfd04ecdae1280a563d06b32949befaf71"><code>d67d09b</code></a> Bump mypy version</li> <li><a href="https://github.com/urllib3/urllib3/commit/20032ec38a09680bcfb6d97b4c43b276af43cc64"><code>20032ec</code></a> Drop unneeded dependency pins and a warning filter</li> <li>Additional commits viewable in <a href="https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
When Bazel is configured with the
--symlink_prefixoption, the sphinxdocs.servetarget fails to serve files from the correct directory. This happens because the directory layout underexecrootand the workspace no longer match, causing the target to miss the generated HTML files.This change updates the logic to use rpathlocation instead, ensuring the correct path is resolved regardless of symlink configuration.
Fixes #3410